<?
	/**
	* @return void
	* @param void
	* @desc Show document path 
	**/
	
function get_track($level=false){
	global $http_path, $tree, $env;

	$cnt=0;
	$pointer="";
	$stream=array();
	if (is_array($env["argv"]))
	foreach ($env["argv"] as $key=>$arg) {
		if(!isset($page["MASK"])){
			if(isset($page)) $stream[++$cnt]["title"]=$page["TITLE"];
			$stream[$cnt]["href"]=preg_replace("/\[\"/", "/", $pointer);
			$stream[$cnt]["href"]=preg_replace("/\/$/", "", $http_path) . preg_replace("/\"\]/", "", $stream[$cnt]["href"]) . "/";
			$prev_pointer=$pointer;
			$pointer.="[\"" . $arg . "\"]";
			$code="\$page=\$tree->structure[\"root\"]".$pointer.";";
			eval($code);
		}
	}
	if(!isset($page["MASK"]) and isset($page)){
		$stream[++$cnt]["title"]=$page["TITLE"];
		$stream[$cnt]["href"]=preg_replace("/\[\"/", "/", $pointer);
		$stream[$cnt]["href"]=preg_replace("/\/$/", "", $http_path) . preg_replace("/\"\]/", "", $stream[$cnt]["href"]) . "/";
	}
		$stream[$cnt]["last"]=true;
		$stream[0]["title"]=($GLOBALS["FirstTrackItemName"]?$GLOBALS["FirstTrackItemName"]:"Home");
		
	if($stream) {
		$__counter = 0;
		$sapi_obj->env["this.length"] = count($stream);
		foreach ($stream as $key => $fetch) {
			$stream[$key]["counter"] = ++$__counter;
			if($level AND $__counter<=$level) unset($stream[$key]);
		}
	}
		
	return $stream;
}
?>